/*
 * @Author: 陈俊升 761723995@qq.com
 * @Date: 2023-11-08 08:51:15
 * @LastEditors: 陈俊升 761723995@qq.com
 * @LastEditTime: 2023-12-09 09:22:20
 * @FilePath: /hr_new_vue3/src/apis/management/contract/baseSetting/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/* 合同 基础设置api */

import { ajaxService } from '@/utils/request';
import * as type from './type';

const env = import.meta.env;
// const baseURL1 = env.VITE_API_BASE_URL;
// const baseURL1 = env.VITE_DEV_BASE_URL// const baseURL = 'http://192.168.31.129:39003';
// const baseURL = 'http://192.168.31.129:39003';
const baseURL = env.VITE_DEV_BASE_URL;
// const baseURL = env.VITE_APP_BASE_URL;
const baseURL2 = env.VITE_APP_BASE_URL;
const baseURL3 = env.VITE_DEV_BASE_URL;

/**
 * 新增合同类型
 */
export function AddContractGroupType(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template',
    method: 'post',
    data,
    baseURL
  });
}

/**
 * 新增合同类型查重
 */
export function CheckContractGroupType(params: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/repeat',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 修改合同类型
 */
export function PutContractGroupType(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 删除合同类型
 */
export function DelContractGroupType(data: { ids: [] }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template',
    method: 'delete',
    data,
    baseURL
  });
}

/**
 * 新增合同分组
 */
export function AddContractGroup(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/group',
    method: 'post',
    data,
    baseURL
  });
}

/**
 * 合同分组查重
 */
export function CheckContractGroup(params: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/group/repeat',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 编辑合同分组
 */
export function ChangeContractGroup(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/group',
    method: 'put',
    data,
    baseURL
  });
}
/**
 * 编辑合同排序
 */
export function ChangeContractGroupSort(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/group/sort',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 获取合同分组
 */
export function GetContractGroup(params: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/group',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 获取合同模板列表
 */
export function GetContractTemplateList(params: { typeId: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/template',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 获取合同模板详情
 */
export function GetContractTemplateDetail(params: { id: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/detail',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 修改合同模板默认模板
 */
export function GetContractTemplateDefault(data: {
  typeId: number;
  id: number;
}) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/template/default',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 新增合同模板
 */
export function AddContractTemplate(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/template',
    method: 'post',
    data,
    baseURL
  });
}

/**
 * 修改合同模板
 */
export function PutContractTemplate(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/template',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 删除合同模板
 */
export function DelContractTemplate(data: { ids: number; type: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/template',
    method: 'delete',
    data,
    baseURL
  });
}
/**
 * 查重合同模板
 */
export function CheckContractTemplate(params: { id: number; name: string }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/template/repeat',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 获取合同分组
 */
export function DelContractGroup(params: { id: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/group',
    method: 'delete',
    params,
    baseURL
  });
}

/**
 * 获取合同预警
 */
export function GetContractRemind() {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_remind',
    method: 'get',
    baseURL
  });
}

/**
 * 修改合同预警
 */
export function PutContractRemind(data: any) {
  return ajaxService(
    {
      url: '/hr/contract/basic_setting/contract_remind',
      method: 'put',
      data,
      baseURL
    },
    {
      message: '修改成功',
      mode: 'success'
    }
  );
}

/**
 * 新增合同异动类型
 */
export function AddContractStatusType(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_status_type',
    method: 'post',
    data,
    baseURL
  });
}

/**
 * 查重合同异动类型
 */
export function CheckContractStatusType(params: {
  type: number;
  name: string;
}) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_status_type/repeat',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 获取合同异动类型
 */
export function GetContractStatusType(params: { type: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_status_type',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 编辑合同异动类型
 */
export function PutContractStatusType(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_status_type',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 删除合同异动类型
 */
export function DelContractStatusType(data: { ids: [] }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_status_type',
    method: 'delete',
    data,
    baseURL
  });
}

/**
 * 获取合同续签模板列表
 */
export function GetContractRenewalTemplateList(params: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 新增合同续签模板
 */
export function AddContractRenewalTemplate(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common',
    method: 'post',
    data,
    baseURL
  });
}

/**
 * 修改合同续签模板
 */
export function ChangeContractRenewalTemplateDefault(data: { id: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/default',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 查重合同续签模板
 */
export function CheckContractRenewalTemplate(params: { name: string }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/repeat',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 获取合同续签模板详情
 */
export function GetContractRenewalTemplateDetail(params: { id: number }) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/detail',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 修改合同续签模板
 */
export function PutContractRenewalTemplate(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 删除合同续签模板
 * type 1模板 2子集 3控件
 * ids 对应的id
 */
export function DelContractRenewalTemplate(data: {
  type: 1 | 2 | 3;
  ids: number[];
}) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common',
    method: 'delete',
    data,
    baseURL
  });
}

/**
 * 新增用户续签沟通数据
 */
export function AddUserRenewCommunicate(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/use',
    method: 'post',
    data,
    baseURL
  });
}

/**
 * 用户续签沟通列表
 */
export function GetUserRenewCommunicatePage(params: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/contract',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 用户续签沟通详情
 */
export function GetUserRenewCommunicate(params: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/contract/detail',
    method: 'get',
    params,
    baseURL
  });
}

/**
 * 提交用户续签沟通
 */
export function EditUserRenewCommunicate(data: any) {
  return ajaxService({
    url: '/hr/contract/basic_setting/contract_type_template/common/contract/detail',
    method: 'put',
    data,
    baseURL
  });
}

/**
 * 修改用户续签状态
 */
export function EditUserRenewState(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/renewal',
    method: 'put',
    data,
    baseURL
  });
}
